import variables from "@/assets/styles/element-variables.scss";
import defaultSettings from "@/settings";
const { sideTheme, showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings;
const state = {
  theme: variables.theme,
  sideTheme: sideTheme,
  showSettings: showSettings,
  tagsView: tagsView,
  fixedHeader: fixedHeader,
  sidebarLogo: sidebarLogo,
  clue: null,
  loadClueTime: null,
  companyTitle: "CRM后台管理系统",
  companyLogo: ""
};

const mutations = {
  CHANGE_SETTING: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value;
    }
  },
  SET_CLUE: (state, clue) => {
    state.clue = clue;
  },
  SET_LOAD_CLUE_TIME: (state, data) => {
    state.loadClueTime = data;
  },
  SET_TITLE: (state, data) => {
    state.companyTitle = data;
  },
  SET_LOGO: (state, data) => {
    state.companyLogo = data;
  }

};

const actions = {
  changeSetting({ commit }, data) {
    commit("CHANGE_SETTING", data);
  },
  setClue({ commit }, data) {
    commit("SET_CLUE", data);
  },
  setLoadClueTime({ commit }, data) {
    commit("SET_LOAD_CLUE_TIME", data);
  },
  SetTitle({ commit }, data) {
    commit("SET_TITLE", data);
  },
  SetLogo({ commit }, data) {
    commit("SET_LOGO", data);
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};

